package com.vvv.designpattern.transaction.colleague;

import com.vvv.designpattern.transaction.mediator.AbstractMediator;

/**
 * @author vvv
 * @date 2023-11-25 17 01
 * discription 中介者模式：
 * AbstractCustomer为抽象同事类，需要关联中介者，需要定义与中介者进行交流的方法
 * 需要有一些核心的属性如orderId，当前用户信息等
 */
public abstract class AbstractCustomer {

    public AbstractMediator mediator;

    public String orderId;

    public String customerName;

    public AbstractCustomer(AbstractMediator mediator, String orderId, String customerName) {
        this.mediator = mediator;
        this.orderId = orderId;
        this.customerName = customerName;
    }

    public String getCustomerName() {
        return customerName;
    }

    /**
     * 与中介者进行交流的方法 子类实现
     * @param orderId
     * @param targetCustomer
     * @param payResult
     */
    public abstract void messageTransfer(String orderId, String targetCustomer, String payResult);
}
